﻿using System;

namespace KinectApi
{

    public enum KinectGesture
    {
        SwipeLeft = 1,
        SwipeRight = 2,
        PushButton = 3,
        PullButton = 4,
    }

    public delegate void LiveTrackingHandler(int skeletonId, object[] parameters);
    public delegate void GestureHandler(int skeletonId, object[] parameters);

    public static class KinectEventManager
    {

        /// <summary>
        /// Initializez Kinect librararies synchronously
        /// </summary>
        /// <returns>True is successful</returns>
        public static bool InitializeSdk()
        {
            // will start sdk and configure params for tracking
            throw new NotImplementedException();
        }

        /// <summary>
        /// Starts tracking using kinect sdk and triggering of events
        /// </summary>
        /// <returns></returns>
        public static bool StartTracking()
        {
            // validates library was inited ok

            // starts background worker for tracking kinect
            // handlers are triggered on the DispatcherThread for WPF correct handling ?
            // to see when start is called if the Dispatcher is required
            throw new NotImplementedException();
        }

        /// <summary>
        /// Suspends tracking for all kinect events
        /// </summary>
        /// <returns></returns>
        public static bool SuspendTracking()
        {
            // suspends worker and clear gesture tracking
            throw new NotImplementedException();
        }

        /// <summary>
        /// Suspends tracking for kinect event
        /// </summary>
        /// <returns></returns>
        public static bool SuspendEvent()
        {
            throw new NotImplementedException();
        }

        public static bool StopTracking()
        {
            // stops worker and destroys sdk
            throw new NotImplementedException();
        }

        // @todo - register custom coordonates calculator - is required ?
        // will translate coordonates from kinect to program coordonates with custom function
        // default function return 1:1 coordonates

        /// <summary>
        /// Registers a handler for live tracking
        /// </summary>
        /// <param name="handler">Handler when gesture is tracked</param>
        public static void RegisterLiveHandler(LiveTrackingHandler handler)
        {
            throw new NotImplementedException();
        }

        /// <summary>
        /// Registers a handler for a gesture type
        /// </summary>
        /// <param name="gesture">Gesture to be tracked</param>
        /// <param name="handler">Handler when gesture is done</param>
        /// <returns></returns>
        public static bool RegisterGestureHandler(KinectGesture gesture, GestureHandler handler)
        {
            throw new NotImplementedException();
        }

    }
}
